<include file="public@header" />
</head>
<body>
	<div class="wrap">
		<ul class="nav nav-tabs">
			<li><a href="{:url('user/shops')}">店长列表</a></li>
			<li class="active"><a href="{:url('user/shopsadd')}">店长添加</a></li>
		</ul>
		<form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('user/shopAddpost')}">
			<div class="form-group">
				<label for="real_name" class="col-sm-2 control-label"><span class="form-required">*</span>真实姓名</label>
				<div class="col-md-6 col-sm-10">
					<input type="text" class="form-control" id="real_name" name="real_name" required>
				</div>
			</div>
			<div class="form-group">
				<label for="id_card" class="col-sm-2 control-label"><span class="form-required">*</span>身份证号</label>
				<div class="col-md-6 col-sm-10">
					<input type="text" class="form-control" id="id_card" name="id_card" required>
				</div>
			</div>
			<div class="form-group">
				<label for="brand_name" class="col-sm-2 control-label"><span class="form-required">*</span>代理商平台名称</label>
				<div class="col-md-6 col-sm-10">
					<if condition="$id == 1">
						<select name="brand_name" onchange="shoptype($(this).val())">
							<option value="">请选择</option>
							<volist name="ret" id="vo">
								<option value="{$vo.user_id}">{$vo.brand_name}</option>
							</volist>
						</select>
						<span id="shop_type"></span>
					</select>
					<else />
						<input type="hidden" name="brand_name" value="{$ret1.id}">{$ret1.brand_name}
						　　店铺：<select name="shopid">
								    <option value="">请选择</option>
									<volist name="list" id="v">
										<option value="{$v.re_guid}">{$v.shop_name}</option>
									</volist>
							    </select>
					</if>
				</div>
			</div>
			<div class="form-group">
				<label for="mobile" class="col-sm-2 control-label"><span class="form-required">*</span>手机号</label>
				<div class="col-md-6 col-sm-10">
					<input type="text" class="form-control" id="mobile" name="mobile" required>
				</div>
			</div>
			<div class="form-group">
				<label for="input-user_login" class="col-sm-2 control-label"><span class="form-required">*</span>性别</label>
				<div class="col-md-6 col-sm-10">
					<input type="radio" id="sex" name="sex" value="1">男
					<input type="radio" id="sex" name="sex" value="2">女
				</div>
			</div>
			<div class="form-group">
				<label for="input-user_pass" class="col-sm-2 control-label"><span class="form-required">*</span>密码</label>
				<div class="col-md-6 col-sm-10">
					<input type="text" class="form-control" id="input-user_pass" name="user_pass" placeholder="******" required>
				</div>
			</div>
			<div class="form-group">
				<label for="user_email" class="col-sm-2 control-label"><span class="form-required">*</span>邮箱</label>
				<div class="col-md-6 col-sm-10">
					<input type="text" class="form-control" id="user_email" name="user_email" required>
				</div>
			</div>
			<div class="form-group">
				<label for="incode" class="col-sm-2 control-label"><span class="form-required">*</span>激活码</label>
				<div class="col-md-6 col-sm-10">
					<input type="text" class="form-control" id="incode" name="incode">
				</div>
			</div>
			<div class="form-group">
				<label for="role_id" class="col-sm-2 control-label"><span class="form-required">*</span>角色</label>
				<div class="col-md-6 col-sm-10">
					<foreach name="roles" item="vo">
						<label class="checkbox-inline">
							<input value="{$vo.id}" type="radio" id="role_id" name="role_id">{$vo.name}
						</label>
					</foreach>
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-offset-2 col-sm-10">
					<button type="submit" class="btn btn-primary js-ajax-submit">{:lang('ADD')}</button>&nbsp;&nbsp;
					<if condition="$id != 1">
						<if condition="$ret1.shop_guid == ''">
							<a href="{:url('User/becomeshop')}" class="btn btn-primary">成为店长</a>
						</if>
					</if>

				</div>
			</div>
		</form>
	</div>
	<script src="__STATIC__/js/admin.js"></script>
</body>
<script>
    function shoptype(id){
        if(id !=''){
            $.post("{:url('User/getShops')}",{'id':id},function (date){
                var html = "";
                html+="　　店铺：<select id='shopid' name='shopid'>";
                html+="<option value=''>请选择店铺</option>";
                for(var i=0;i<date.length;i++){
                    html+="<option value="+date[i].re_guid+">"+date[i].shop_name+"</option>";
                }
                html+='</secect>';
                $('#shop_type').html(html);
            });
        }else{
            $('#shop_type').empty();
        }

    }
</script>
</html>